package com.bw.my.mvvm.view;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.bw.mvvm.arouter.MyARouter;
import com.bw.mvvm.custom.BottomCustom;
import com.bw.mvvm.mvvm.view.BaseFragment;
import com.bw.mvvm.utils.SpUtils;
import com.bw.my.BR;
import com.bw.my.R;
import com.bw.my.databinding.FragmentMyBinding;
import com.bw.my.mvvm.viewmodel.MyViewModel;


@Route(path = MyARouter.MYFRAGMENT)
public class MyFragment extends BaseFragment<FragmentMyBinding, MyViewModel> {

    public BottomCustom my_order,completed,receiving,obligation;
    @Override
    public int bindLayout() {
        return R.layout.fragment_my;
    }

    @Override
    public int initVerable() {
        return BR.my;
    }

    @Override
    public void onResume() {
        super.onResume();

        String user = SpUtils.getUser();
        if (user != null){
            vm.loginTitle.set(user);
            vm.regTitle.set("");
        }else {
            vm.loginTitle.set("登录 / ");
            vm.regTitle.set("注册");
        }

    }

    @Override
    public void onStart() {
        super.onStart();
        initView();
        obligation.setConten("待付款")
                .setSelImag(R.drawable.icon_order_wait_pay)
                .setNomalImag(R.drawable.icon_order_wait_pay)
                .setSelSize(5)
                .setNomalSize(5)
                .setLinstenner(vm)
                .refresh();
        receiving.setConten("待收货")
                .setSelImag(R.drawable.icon_order_wait_confirm)
                .setNomalImag(R.drawable.icon_order_wait_confirm)
                .setSelSize(5)
                .setNomalSize(5)
                .setLinstenner(vm)
                .refresh();
        completed.setConten("已完成")
                .setSelImag(R.drawable.icon_order_completed)
                .setNomalImag(R.drawable.icon_order_completed)
                .setSelSize(5)
                .setNomalSize(5)
                .setLinstenner(vm)
                .refresh();
        my_order.setConten("我的订单")
                .setSelImag(R.drawable.icon_order)
                .setNomalImag(R.drawable.icon_order)
                .setSelSize(5)
                .setNomalSize(5)
                .setLinstenner(vm)
                .refresh();
    }

    private void initView() {

        my_order = v.getRoot().findViewById(R.id.user_myorder);
        completed = v.getRoot().findViewById(R.id.user_completed);
        receiving = v.getRoot().findViewById(R.id.user_receiving);
        obligation = v.getRoot().findViewById(R.id.user_obligation);
    }


}
